/*
 *  Copyright 2007-2008 by Matthias Buch-Kromann <mbk.isv@cbs.dk>.
 *  *
 *  This file is part of the Open-source Dependency Toolkit (OSDT),
 *  see http://code.google.com/p/open-source-dependency-toolkit.
 *  
 *  The OSDT is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as 
 *  published by the Free Software Foundation, either version 3 of 
 *  the License, or (at your option) any later version.
 * 
 *  The OSDT is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 * 
 *  You should have received a copy of the GNU Lesser General Public 
 *  License along with the OSDT in the files COPYING and COPYING.LESSER.
 *  If not, see http://www.gnu.org/licenses.
 */

package org.osdtsystem.search;

import org.osdtsystem.graphs.Graph;
import org.osdtsystem.operations.Operation;

/**
 * Public interface for search managers that collect information about 
 * best improvements and decide when the search must be stopped. 
 * @author Matthias Buch-Kromann <mbk.isv@cbs.dk>
 */
public interface SearchManager {
    /**
     * Return the cost of the lowest-cost state in the currently
     * explored search space
     * @return the lowest cost in the currently explored search space
     */
    public double getBestCost();

    /**
     * Return the graph corresponding to the lowest-cost state in the currently 
     * explored search space.
     * @return the lowest-cost graph in the currently explored search space
     */
    public Graph getBestGraph();
    
    /**
     * Return the operation corresponding to the lowest-cost state in the currently
     * explored search space
     * @return the lowest-cost operation in the currently explored search space
     */
    public Operation getBestOperation();
    
    /**
     * Inform the search manager that the search has reached the given graph
     * from the base graph by means of the given operation, and ask for permission
     * to explore the search space from this state. 
     * @param graph the visited graph in the state
     * @param operation the operation used to reach the state
     * @return <code>true</code> if the search is allowed to proceed from this state,
     * <code>false</code> otherwise.
     */
    public boolean addState(Graph graph, Operation operation);
}
